package com.oocl.msgProcess;

import java.awt.Rectangle;
import java.util.Timer;
import java.util.TimerTask;

import com.oocl.tm.log4j.Log4j;
import com.oocl.tm.ui.ChatFrame;

public class ShakeProcess {
	
	public ChatFrame window;
	
	public ShakeProcess( ChatFrame window){
		try {
			this.window = window;
			int delay = 50;
			Timer timer = new Timer();
			Timer timer1 = new Timer();
			timer.schedule(new MoveUp(), 100, 80);
			timer.schedule(new MoveDown(), 150, 80);
			Thread.sleep(400);
			timer.cancel();
			timer1.cancel();
		} catch (InterruptedException e) {
			Log4j.getLogger().error(e, e.fillInStackTrace());
		}
		
	}
	
	
	
	class MoveUp extends TimerTask{

		public void run() {
			Rectangle location =  window.getBounds();
			int x = location.x;
			int y = location.y;
			window.setLocation(x+8,y+8);
		}
		
	}
	
	class MoveDown extends TimerTask{

		public void run() {
			Rectangle location = window.getBounds();
			int x = location.x;
			int y = location.y;
			window.setLocation(x-8,y-8);
		}
		
		
	}

}
